﻿using Microsoft.AspNetCore.Mvc;
using OConf.API.Filter;
using OConf.IBLL;
using OConf.Model.Common;
using OConf.Model.RequestInput.ProjectInfo;

namespace OConf.API.Controllers
{
    [Route("/api/[Controller]")]
    [ApiController]
    public class ConfigBackEndController : ControllerBase
    {
        private readonly IProjectInfoBLL _projectInfoBLL;

        public ConfigBackEndController(IProjectInfoBLL projectInfoBLL)
        {
            _projectInfoBLL = projectInfoBLL;
        }

        /// <summary>
        /// 后台接口项目获取配置信息接口
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [SignForApi]
        [HttpPost("V2/GetBackProgramConfigInfo")]
        public ReturnData<BackProgramConfigInfo> GetBackProgramConfigInfoV2([FromBody] BackProgramGetConfigInfoInput input)
        {
            return _projectInfoBLL.GetBackProgramConfigInfo(input);
        }

        /// <summary>
        /// 检查配置信息版本
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [SignForApi]
        [HttpPost("V2/CheckConfigInfo")]
        public ReturnData<BackProgramConfigInfo> CheckConfigInfo([FromBody] CheckConfigInfoInput input)
        {
            return _projectInfoBLL.CheckConfigInfo(input);
        }
    }
}